package com.ghh.app.monsterrush.monsters;

import java.util.ArrayList;
import java.util.List;

import com.ghh.app.monsterrush.AbstractFactory;
import com.ghh.app.monsterrush.MonsterActor;
import com.ghh.app.monsterrush.MonsterRushGame;

public class MonsterFactory extends AbstractFactory<MonsterActor> {
	private MonsterRushGame				game;

	private static final List<Weight>	wl	= new ArrayList<Weight>();
	static {
		wl.add(new Weight("zombie", 1));
		wl.add(new Weight("nerdZombie", 1));
		wl.add(new Weight("slime", 3));
	}

	public MonsterFactory(MonsterRushGame game) {
		super(wl);
		this.game = game;
	}

	@Override
	protected MonsterActor create(String name) {
		if ("zombie".equals(name)) {
			return new Zombie(game);
		}
		if ("nerdZombie".equals(name)) {
			return new NerdZombie(game);
		}
		if ("slime".equals(name)) {
			return new Slime(game);
		}
		throw new IllegalArgumentException("can not find the MonsterActor by name " + name);
	}
}
